﻿using System.Threading.Tasks;
using Microsoft.Playwright;

namespace BrowserCollect;

/// <summary>
/// Playwright采集脚本接口
/// </summary>
public interface ICollectScript
{
    /// <summary>
    /// 判断该采集脚本是否适用于当前url
    /// </summary>
    /// <param name="url">需要采集的url</param>
    /// <returns></returns>
    public bool IsMatch(string url);
    
    /// <summary>
    /// 通过playwright获取url的html页面
    /// </summary>
    /// <param name="url">需要采集的url</param>
    /// <param name="page">单个标签页的实例</param>
    /// <returns></returns>
    public Task<string> GetHtml(string url, IPage page);
}